package com.wen.strategyPattern;

/**
 * 算法封装对象:屏蔽高层模块与算法或者策略的直接接触，里面维护算法对象，不同业务传值不一样
 */
public class Context {
    private Strategy strategy;

    public Context(Strategy strategy) {
        this.strategy = strategy;
    }
    public void handle(){
        strategy.algorithMethod();
    }

    public Strategy getStrategy() {
        return strategy;
    }

    public void setStrategy(Strategy strategy) {
        this.strategy = strategy;
    }
}
